﻿<UserControl x:Class="theeg.DependencyAnalysis.CommonAddin.Views.CommonTests"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:models="clr-namespace:theeg.DependencyAnalysis.CommonAddin.Models"
             xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="500">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/CommonStyles.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
            <DataTemplate DataType="{x:Type models:RuleDescriptor}">
                <StackPanel Orientation="Horizontal">
                    <Image x:Name="stateImage"></Image>
                    <TextBlock Text="{Binding Name}" FontSize="12" FontWeight="Medium" VerticalAlignment="Center" Margin="3,0,0,0"></TextBlock>
                </StackPanel>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding State}" Value="Uncompiled">
                        <Setter TargetName="stateImage" Property="Source" Value="../Resources/Inconclusive26.png"></Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding State}" Value="NotRun">
                        <Setter TargetName="stateImage" Property="Source" Value="../Resources/Inconclusive26.png"></Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding State}" Value="Success">
                        <Setter TargetName="stateImage" Property="Source" Value="../Resources/Success26.png"></Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding State}" Value="Assert">
                        <Setter TargetName="stateImage" Property="Source" Value="../Resources/Error26.png"></Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding State}" Value="Exception">
                        <Setter TargetName="stateImage" Property="Source" Value="../Resources/Unavailable26.png"></Setter>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="240"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid Margin="0,0,3,0">
            <Grid.Tag>
                <CollectionViewSource x:Name="RuleSource" Source="{Binding Rules}">
                    <CollectionViewSource.SortDescriptions>
                        <scm:SortDescription Direction="Ascending" PropertyName="Name"/>
                    </CollectionViewSource.SortDescriptions>
                </CollectionViewSource>
            </Grid.Tag>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <WrapPanel Orientation="Horizontal">
                <Button Command="{Binding RunSelectedCommand}" Style="{StaticResource NullButtonStyle}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="../Resources/RunSelected.png"></Image>
                        <TextBlock>Run</TextBlock>
                    </StackPanel>
                </Button>
                <Button Command="{Binding RunAllCommand}" Style="{StaticResource NullButtonStyle}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="../Resources/RunTests.png"></Image>
                        <TextBlock>Run All</TextBlock>
                    </StackPanel>
                </Button>
                <Button Command="{Binding AddCommand}" Style="{StaticResource NullButtonStyle}">Add</Button>
            </WrapPanel>
            <ListBox ItemsSource="{Binding ElementName=RuleSource}" SelectedItem="{Binding SelectedRule}" Grid.Row="1" Background="{x:Null}"
                      Foreground="White" ScrollViewer.PanningMode="Both">
            </ListBox>
        </Grid>
        <GridSplitter Grid.Column="0" Width="3" Background="#FF196990"></GridSplitter>
        <TabControl Grid.Column="2" Background="{x:Null}">
            <TabItem Header="Results" Background="{x:Null}">
                <TextBox TextWrapping="WrapWithOverflow" Text="{Binding SelectedRule.Results}" CaretBrush="LightBlue" IsReadOnly="True" Background="{x:Null}"
                         FontWeight="Medium" FontSize="14" Foreground="White"></TextBox>
            </TabItem>
            <TabItem Header="Source">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <TextBox Grid.Row="0" Text="{Binding SelectedRule.Name}" CaretBrush="LightBlue" TextWrapping="WrapWithOverflow" Background="{x:Null}" Foreground="White"
                             IsReadOnly="True" ></TextBox>
                    <TextBox Grid.Row="1" Text="{Binding SelectedRule.Source}" TextWrapping="WrapWithOverflow" Background="{x:Null}" Foreground="White"
                             FontWeight="Medium" FontSize="14" CaretBrush="LightBlue" AcceptsReturn="True"></TextBox>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>
